package pub.guoxin.oops.manager.controller;

import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import pub.guoxin.oops.annotation.InjectUser;
import pub.guoxin.oops.model.User;
import pub.guoxin.oops.vo.ResultVo;
import pub.guoxin.oops.vo.ResultVoBuilder;

/**
 * Created by guoxin on 18-1-25.
 */
@RestController
@RequestMapping("/test")
public class TestController {

    @Autowired
    private ResultVoBuilder builder;

    @ApiOperation(value = "发送手机验证码", notes = "发送手机验证码")
    @PostMapping(value = "/", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ResultVo add(@InjectUser User user) {

        Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
        System.out.println(principal.toString());
        return builder.buildSuccessResultInfo();

    }

}
